package router

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
	"github.com/gogf/gf/v2/os/gfile"
	"go-websocket/internal/controller/im"
	"go-websocket/internal/middleware"
)



var Http *ghttp.Server

func init()  {
	//http服务
	http := g.Server("http")


	http.Use(middleware.MiddlewareCORS)

	http.Group("/", func(group *ghttp.RouterGroup) {
		group.POST("/user/login", im.User.Login)
	})

	http.Group("/im", func(group *ghttp.RouterGroup) {
		group.Middleware(middleware.VerifyToken)
		group.POST("/message/textMsg", im.Message.TextMsg)
		group.POST("/vendor/getMemberPhotos", im.Vendor.GetMemberPhotos)
		group.POST("/get/base", im.Get.Base)
	})

	http.SetPort(8282)
	http.SetIndexFolder(false)
	http.SetServerRoot(gfile.MainPkgPath())
	Http = http
	//http.Start()

}
